import React, { Component } from 'react'
import { withRouter } from 'react-router-dom'

class Header extends Component {
  back = () => {
    this.props.history.goBack()
  }
  forward = () => {
    this.props.history.goForward()
  }
  toReplace = () => {
    this.props.history.replace(`/home/message/detail/01`)
  }
  render() {
    console.log('header', this.props)
    return (
      <div>
        <button onClick={this.back}>goback</button>
        <button onClick={this.forward}>next</button>
        <button onClick={this.toReplace}>replace</button>
      </div>
    )
  }
}

export default withRouter(Header)
